package com.lelouch.concurrency.example.atomic;

import com.lelouch.concurrency.annotation.ThreadSafe;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.atomic.LongAdder;

/**
 * AtomicReference
 *
 * @author lcy
 * @create 2018-05-10 13:59
 */
@ThreadSafe
@Slf4j
public class AtomicExample3 {

    private static AtomicReference<Integer> count = new AtomicReference<>(0);

    public static void main(String[] args) {
        count.compareAndSet(0,2);
        count.compareAndSet(2,4);
        log.info("Count:{}",count);
    }
}
